﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BneyBaruch.Technology.SourcesRepository.EntityModel;
using FluentNHibernate.Mapping;

namespace BneyBaruch.Technology.SourcesRepository.PersistenceModel.NHibernate.Mappings
{
    public class AuthorEntityMap : ClassMap<AuthorEntity>
    {
        public AuthorEntityMap()
        {
            Table("Authors");
            Id(e => e.Id)
                .Column("AuthorId")
                .GeneratedBy
                    .Increment();
            Map(e => e.AuthorName)
                .Column("AuthorName")
                .Length(100)
                .Not.Nullable()
                .Unique();
            Map(e => e.AuthorShortName)
                .Column("AuthorShortName")
                .Length(100)
                .Not.Nullable()
                .Unique();
        }
    }
}
